import requests
from concurrent.futures import ThreadPoolExecutor

# 接口 URL 模板
url_template = "http://106.55.8.90:7001/api/ccSmart/syncDimensionByTrackSpanId/invoke?force=true&spanId={}"

# 不同的 spanId 列表
span_ids = [
"xecl4z8d25l34",
"xeddomi1u6kn4",
"xe4ourr78b7r4",
"xea5f3vjmugao",
"xediqlqll8tfk",
"xem049zvdeiv4",
"xeqre5koizzeo",
"xejkeemr9j75s",
"xewg9nnx7vw8w",
"xee689rdaqyo0",
"xematn7ne4c1s",
"xesn6tbttscn4",
"xejq1slssym0w",
"xen8f9q1vyqyo",
"xelg72dmzpu68",
"xe6xqzz72vpc0",
"xegox6soadzpc",
"xenj4my558dmo",
"xep47xh3ie22o",
"xerni98ujxh4w",
"xe4b48tg3979c",
"xeaqtubhr82yo",
"xejd9hth487i8",
"xew1zu1j5zmyo",
"xefk6nguddhq8",
"xep2qemtq12bk",
"xeqntp5rvq9z4",
"xehxtl9h3krnk",
"xewcp799g8uf4",
"xe49mpzfbj0g0",
"xesjmcwz6w16o",
"xejnyv1axu8lc",
"xeaemy98iy51c",
"xee9sq62qbksg",
"xef2cdfmdkfeo",
"xe7o7po1ibwn4",
"xepo5531mgz5s",
"xesubq4wwf6rk",
"xecbx4uf0fwu8",
"xeqwg4tkk2yo0",
"xeeki3e5d32f4",
"xefd1qnl70agw",
"xer75i1fmo4qo",
"xess8skid5xxc",
"xedf65c2ef2f4",
"xea7i1fydle68",
"xeuo1gbf2blkw",
"xe43zc083bklc",
"xe7h2suw2sveo",
"xep9vbgdkyt4w",
"xevm8hkcxx05c",
"xekf0zglmo6bk",
"xe503foaneeio",
"xeuyqtjqx8dmo",
"xe4grmsv84ge8",
"xelcmlz04jgu8",
"xemee3mcop5hc",
"xejrjbgmi0gzk",
"xe3t9ys0y7sw0",
"xenbzq4zs66tc",
"xed2z9aiwlgqo",
"xeli9zyca1clc",
"xepva1wfsn7y8",
"xergdcfmcirk0",
"xehjjrmow82rk",
"xej4n25taoi68",
"xenmp3d29zq4g",
"xean9dwt34cn4",
"xecfhl957herk",
"xetc606mxhc00",
"xea0d4mlqcwzk",
"xe578cht4fo5c",
"xefgm72bvj2tc",
"xeh1phl53wyyo",
"xeimss498c4xs",
"xeukgzwrd6g3k",
"xecq6yhuqc6ww",
"xex3rborpa8sg",
"xeeyrx10tv3eo",
"xegjv7jz21rls",
"xer23iss29gxs",
"xesxw6jlajbpc",
"xe3yxcrbda800",
"xeqpb807fbcow",
"xesaeij5xhcsg",
"xetvht1zsdngg",
"xece02et77ny8",
"xeg20xi7kham8",
"xeu676a4kks8w",
"xefej9hx4s4xs",
"xetjawzzi7wu8",
"xek5t52hh8nwg",
"xe4ltm1hr35z4",

]

# 请求头
headers = {
    'User-Agent': 'Apifox/1.0.0 (https://apifox.com)'
}

# 定义请求函数
def call_api(span_id):
    url = url_template.format(span_id)
    try:
        requests.get(url, headers=headers, timeout=1)  # 设置 timeout 避免阻塞
        print(f"Request sent with spanId={span_id}")
    except Exception as e:
        print(f"Error with spanId={span_id}: {e}")

# 使用线程池异步调用
with ThreadPoolExecutor(max_workers=10) as executor:  # 最多 10 个并发
    executor.map(call_api, span_ids)

print("All requests sent asynchronously!")